import React from 'react'
import '../../css/practice.css'
export default function index() {

  let arr = [[0, 1], [2, 3], [4,[4,6], 5],[4,556]]
  // function asd(query:any) {
  //   let arr2 = query.reduce((acc: any,val: any) => {
  //       return acc.concat(
  //         Array.isArray(val) ? asd(val) : val
          
  //       )
  //   },[])
  //   return arr2
  // }
  // let qwe = asd(arr);
  // console.log(qwe);
  let newList: any = [];
  let asd = (query :any) => {
    for(let i = 0; i< query.length; i++) {
      if(Array.isArray(query[i])) {
        asd(query[i])
      } else {
        newList.push(query[i])
      }
    }
  }
  asd(arr);
  console.log(newList);
  
  
  // var flattened = [[0, 1], [2, 3], [4, 5]].reduce(
  //   ( acc, cur ) => acc.concat(cur),
  //   []
  //  );
  //  console.log(flattened);
   
  return (
    <div>
      练习
      <img src='https://img1.baidu.com/it/u=2102736929,2417598652&fm=26&fmt=auto' draggable='true' />
      <div id = 'father'>
        <div id = 'son'></div>
      </div>
    </div>
  )
}
